#ifndef SPEEDOMETERWIDGET_H
#define SPEEDOMETERWIDGET_H

#include <QWidget>
#include <BHXJControls3D/bhxjglbasewidget.h>
#include<BHXJControls3D/bhxjglspeedometer.h>
#include<BHXJControls3D/bhxjgltachometer.h>
#include<BHXJControls3D/bhxjglwaterwave.h>

class speedometerwidget : public BHXJGLBaseWidget
{

    Q_OBJECT
public:
    explicit speedometerwidget(QWidget *parent = nullptr);
    virtual ~speedometerwidget() override;

    bool PaintLine(){return _PaintLine;}
    void setPaintLine(bool value){_PaintLine=value;this->updated=true;}

    Q_PROPERTY(float Speed READ Speed WRITE setSpeed)
    float Speed(){return _Speed;}
    void setSpeed(float value){_Speed=value;this->updated=true;}

    Q_PROPERTY(float RPM READ RPM WRITE setRPM)
    float RPM(){return _RPM;}
    void setRPM(float value){_RPM=value;this->updated=true;}


    Q_PROPERTY(bool ortho READ ortho WRITE setortho)
    bool ortho(){return _ortho;}
    void setortho(bool value)
    {
        _ortho=value;
        resetProjection(this->width(),this->height());
        this->updated=true;
    }


signals:

protected:
    bool _PaintLine=false;
    void initializeGL() override;
    void paintGL() override;
    void resizeGL( int width, int height ) override;
    void resetProjection(int width,int height);



    bool _ortho=true;
    float _RPM=0;
    float rpmTemp=0;
    float _Speed{0};
    float speedTemp=0;

    BHXJGLSpeedometer *speedmeter;
    BHXJGLTachometer *tachometer;
    BHXJGLWaterWave *wave;

    virtual void timerEvent(QTimerEvent *) override;
public slots:
};

#endif // SPEEDOMETERWIDGET_H
